package com.smartum.mpr.json.serializers;

import java.io.IOException;

import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;

import com.smartum.mpr.model.JobSubCategory;

public class JobSubCategorySerializer extends JsonSerializer<JobSubCategory>{

	@Override
    public void serialize(JobSubCategory value, JsonGenerator jgen, SerializerProvider provider) throws IOException,
            JsonProcessingException {
		jgen.writeStartObject();
		jgen.writeNumberField("subcategory_id", value.getId());
		jgen.writeStringField("subcategory_name", value.getSubCategoryName());
		jgen.writeNumberField("category_id", value.getCategory().getId());
		jgen.writeStringField("category_name", value.getCategory().getCategoryName());
		jgen.writeEndObject();
    }

}
